package com.foreverwin.mes.console.websocket;

import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mes.core.websocket.WebSocketWrapper;
import org.eclipse.jetty.websocket.WebSocket;

/**
 * @author Ervin Chen
 * @date 2020/1/2 18:27
 */
@com.foreverwin.mes.core.annotation.WebSocketHandler(channel = "123")
public class WebSocketHandler extends WebSocketWrapper {

    @Override
    public void onMessage(String messageType, JSONObject messageBody) {
        JSONObject result = new JSONObject();
        result.put( "result", "OK" );
        //sendMessage( messageType, result );
        publishMessage(result);
    }

    @Override
    public void doAfterOpen(WebSocket.Connection connection) {

    }

    @Override
    public void doAfterClose() {

    }
}
